package name.sra.ui;

import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.image.BufferedImage;

import javax.swing.JFrame;
import javax.swing.JPanel;

public class ImageFrame extends JFrame {

	private BufferedImage bi;
	private ImagePanel panel;
	
	public ImageFrame(BufferedImage bi) {
		super();
		this.bi = bi;
		setMinimumSize(new Dimension(
							Math.min(bi.getWidth(), 700),
							Math.min(bi.getHeight() + 30, 500)));
		panel = new ImagePanel();
		add(panel);
	}

	
	private class ImagePanel extends JPanel {
		
		@Override
		public void paint(Graphics g) {
			super.paint(g);
			g.drawImage(bi, 0, 0, null);
			
		}
	}

	public JPanel getPanel() {
		return panel;
	}
}


